package com.jrzh.mvc.convert.sys;

import org.springframework.stereotype.Component;

import com.jrzh.common.exception.ProjectException;
import com.jrzh.common.utils.ReflectUtils;
import com.jrzh.framework.base.convert.BaseConvertI;
import com.jrzh.mvc.model.sys.I18nModel;
import com.jrzh.mvc.view.sys.I18nView;

@Component("i18nConvert")
public class I18nConvert implements BaseConvertI<I18nModel, I18nView>{

	@Override
	public I18nModel addConvert(I18nView view) throws ProjectException {
		I18nModel model = new I18nModel();
		ReflectUtils.copySameFieldToTarget(view, model);
		return model;
	}

	@Override
	public I18nModel editConvert(I18nView view, I18nModel model) throws ProjectException {
		ReflectUtils.copySameFieldToTargetFilter(view, model, new String[]{"createBy", "createTime"});
		return model;
	}

	@Override
	public I18nView convertToView(I18nModel model) throws ProjectException {
		I18nView view = new I18nView();
		ReflectUtils.copySameFieldToTarget(model, view);
		return view;
	}

}
